
import org.apache.commons.beanutils.PropertyUtils;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.List;

@Service
public class RmsBusinessClosingConfigServiceImpl implements RmsBusinessClosingConfigService  {

    @Resource
    private RmsBusinessClosingConfigMapper rmsBusinessClosingConfigMapper;

    /**
     * 获取 RmsBusinessClosingConfig 分页列表
     */
    @Transactional
    public IPage getRmsBusinessClosingConfigPagination( PaginationVo paginationVo, RmsBusinessClosingConfigQuery rmsBusinessClosingConfigQuery ) throws Exception {

        IPage page = new Page( paginationVo.getPageIndex(), paginationVo.getPageSize() );
        LambdaQueryWrapper<RmsBusinessClosingConfigEntity> lqs = new LambdaQueryWrapper();
        rmsBusinessClosingConfigMapper.selectPage(page, lqs);

        List<RmsBusinessClosingConfigEntity> record = page.getRecords();
        if( !ObjectUtil.isNotEmptyList(record)){
            return page;
        }
        return null;
    }


    /**
     * 获取 RmsBusinessClosingConfig 所有数据
     *
    */
    @Transactional
    public List<RmsBusinessClosingConfigEntity> getRmsBusinessClosingConfigAllList( RmsBusinessClosingConfigQuery rmsBusinessClosingConfigQuery ) throws Exception {

        LambdaQueryWrapper<RmsBusinessClosingConfigEntity> lqs = new LambdaQueryWrapper();
        List<RmsBusinessClosingConfigEntity> list = rmsBusinessClosingConfigMapper.selectList(lqs);
        return list;
    }


    /**
     * 获取 RmsBusinessClosingConfig 详情
    */
    @Transactional
    public RmsBusinessClosingConfigEntity getRmsBusinessClosingConfigDetail( Long id) throws Exception {

        RmsBusinessClosingConfigEntity rmsBusinessClosingConfig = rmsBusinessClosingConfigMapper.selectById(id);
        return rmsBusinessClosingConfig;
    }


    /**
     * 新增 RmsBusinessClosingConfig
     * */
    @Transactional
    public void addRmsBusinessClosingConfig(RmsBusinessClosingConfigVo rmsBusinessClosingConfigVo) throws Exception {

        RmsBusinessClosingConfigEntity rmsBusinessClosingConfig = new RmsBusinessClosingConfigEntity();
        ReflectionCopy.copyProperties( rmsBusinessClosingConfig, rmsBusinessClosingConfigVo );
        rmsBusinessClosingConfigMapper.insert(rmsBusinessClosingConfig);
        return;
    }


    /**
     * 更新 RmsBusinessClosingConfig
     * */
    @Transactional
    public void updateRmsBusinessClosingConfig( RmsBusinessClosingConfigVo rmsBusinessClosingConfigVo) throws Exception {

        if( rmsBusinessClosingConfigVo.getId() == null ){
            throw GlobalException.gen(10021, "id不存在");
        }
        RmsBusinessClosingConfigEntity rmsBusinessClosingConfig = new RmsBusinessClosingConfigEntity();
        ReflectionCopy.copyProperties( rmsBusinessClosingConfig, rmsBusinessClosingConfigVo );
        rmsBusinessClosingConfigMapper.updateById(rmsBusinessClosingConfig);
        return;
    }

    /**
     * 删除 RmsBusinessClosingConfig
     * */
    @Transactional
    public void batchRemoveRmsBusinessClosingConfig( List<Long> ids ) throws Exception {


        if( !ObjectUtil.isNotEmptyList(ids) ){
            throw GlobalException.gen(10011, "要删除的id不存在");
        }
        rmsBusinessClosingConfigMapper.deleteBatchIds(ids);
    }

}

      